package me.xplabs.utils 
{
	import me.xplabs.constant.ResType;
	/**
	 * 资源路径管理
	 * ...
	 * @author xiaohan
	 */
	public class Domain 
	{
		public static const format_swf:String = "swf";
		public static const format_xml:String = "xml";
		public static const format_map:String = "map";
		
		private const _res:String = "resource/";
		public const role:String = _res + "role/r";
		public const headIcon:String = _res + "headIcon/i";
		public const ui:String = _res + "ui/ui.swf";
		public const button:String = "ui.button.i";
		public const font:String = "ui.font.i";
		public const panel:String = "ui.panel.i";
		public const navabtn:String = "ui.navabtn.i";
		public const texture:String = "ui.texture.i";		
		
		private const _fight:String = _res + "fight/";
		public const background:String = _fight + "background/i";
		public const map:String = _res + "map/";
		public const energy:String = _res + "energy/";
		public const build:String = _res + "build/";
		public const skill:String = _res + "skill/";
		public const magic:String = _res + "magic/";
		public const animation:String = _res + "animation/";
		
		public function format(pkey:String,ptype:int):String
		{
			var tempKey:String;
			switch(ptype)
			{
				case ResType.T_SWF:
					tempKey = pkey + "." + format_swf;
					break;
				case ResType.T_XML:
					tempKey = pkey + "." + format_xml;
					break;
				case ResType.T_MAP:
					tempKey = pkey + "." + format_map;
					break;
			}
			return tempKey;
		}
		public function format_getRes(pkey:String):String
		{
			pkey = pkey.replace(_res, "");
			pkey = pkey.replace(/\//g, ".");
			return pkey;
		}
	}
}